home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / scrasm / main.asm < prev    next >
Encoding:
Assembly Source File  |  1993-03-09  |  4.5 KB  |  134 lines

  1. ;;=======================================================================;;
  2. ;;                                                                       ;;
  3. ;; Scrolling Routines -- main program                                    ;;
  4. ;;                                                                       ;;
  5. ;; All other INC files are included here.  The main routines for the     ;;
  6. ;; frame-by-frame execution loop are also here.  Finally I tried to keep ;;
  7. ;; global variables stored in this file as well.                         ;;
  8. ;;                                                                       ;;
  9. ;;=======================================================================;;
  10.                 dosseg
  11.                 .model small
  12.                 .386
  13.  
  14.                 .code
  15.                 extrn   ZTimerOn:far, ZTimerOff:far, ZTimerReport:far
  16.  
  17. INCLUDE constant.inc
  18.  
  19.  
  20. DW_TABLE        MACRO   inc,num
  21.                 count = 0
  22.                 number = 0
  23.                 WHILE (count LT num)
  24.                         DW      number
  25.                         count = count + 1
  26.                         number = number + inc
  27.                         ENDM
  28.                 ENDM
  29.  
  30. DOSPRINT        MACRO   st
  31.                 mov     ah,9
  32.                 mov     dx,st
  33.                 int     21h
  34.                 ENDM
  35.  
  36. EVEN
  37. Mult320         label   WORD
  38. MultBufWidth    label   WORD
  39.                 DW_TABLE 320,200
  40. MultVirtWidth   label   WORD
  41.                 DW_TABLE (VIRTUAL_WIDTH/4),200
  42.  
  43. INCLUDE palette.inc
  44. INCLUDE keyb.inc
  45. INCLUDE modex.inc
  46. INCLUDE page.inc
  47. INCLUDE init.inc
  48. INCLUDE map.inc
  49. ;INCLUDE sprite.inc NOT FOR NOW
  50. INCLUDE scroll.inc
  51.  
  52. ;; Various segments that need to be filled in later...
  53. EVEN
  54. segVideo        dw      0A000h          ; videoram segment
  55. segText         dw      0B800h          ; text segment
  56. segMap          dw      -1              ; Map info segment
  57. segTiles        dw      -1              ; Tile bitmap segment
  58. segBuffer       dw      -1              ; Local 320x200 buffer segment
  59. segCode         dw      -1              ; Code segment
  60. segPSP          dw      -1              ; PSP segment
  61. segPalette      dw      -1              ; Palette segment
  62. segTextPal      dw      -1              ; Saved text palette
  63.  
  64. EVEN
  65. bDoTransition   db      0
  66.  
  67. ;; This routine is called for each frame.
  68. ;; Right now it just scrolls, but later all sprite animation would
  69. ;; occur here too.
  70. EVEN
  71. OneFrame        PROC    near
  72.                 call    Scroll          ; Scrolls the screen
  73. ;               call    AnimateSprites  ; prepares sprites on drawpage
  74.                 jmp     FlipPage        ; shows drawpage...
  75.                 ; no RET necessary
  76. OneFrame        ENDP
  77.  
  78. ;; Each frame -- call the frame motion code, then check for keyhit.
  79. EVEN
  80. MainLoop        PROC    NEAR
  81. next_frame:     call    OneFrame
  82.                 JNKEY   next_frame
  83.                 JKEYP   kESC,all_done   ; ESC -> quit, always
  84.                 call    kprocCur
  85.                 mov     al,bDoTransition
  86.                 cmp     al,0
  87.                 je      next_frame
  88. transition:     FLASH_OFF 16,segPalette
  89.                 mov     bDoTransition,0
  90.                 mov     ax,1
  91.                 sub     ax,nMap
  92.                 mov     nMap,ax         ; Flip maps
  93.  
  94.                 call    LoadData
  95.                 call    update_full     ;<<<<
  96.                 call    OneFrame
  97.                 FLASH_ON 16,segPalette
  98.                 jmp     next_frame
  99. all_done:       ret
  100. MainLoop        ENDP
  101.  
  102. ;; Beginning code -- Leaves text mode (saving the text screen) via
  103. ;;                   a fade.  It loads the map data and draws one
  104. ;;                   frame before it fades on.
  105. Beginning       PROC    near
  106.                 NEW_PAL segTextPal
  107.                 PAL_SAVE segTextPal
  108.                 FADE_OFF 1,segTextPal
  109.                 call    SaveVideo
  110.                 MODEX_START             ; 320x200 Mode X graphics mode
  111.                 PAL_BLACK
  112.  
  113.                 call    LoadData        ; This call will change...
  114.  
  115.                 call    update_full     ;<<<<
  116.                 call    OneFrame
  117.                 FADE_ON 1,segPalette
  118.                 ret
  119. Beginning       ENDP
  120.  
  121. ;; Ending code -- restore to text mode via a flash
  122. Ending          PROC    near
  123.                 FLASH_OFF 8,segPalette
  124.                 call    RestoreVideo
  125.                 FLASH_ON 8,segTextPal
  126.                 ret
  127. Ending          ENDP
  128.  
  129.                 .data
  130.  
  131.                 .stack 2048
  132.  
  133.                 END Initialize
  134.